home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Skunkware 5
/
Skunkware 5.iso
/
bin
/
showexternal
(
.txt
)
< prev
next >
Wrap
Microsoft Windows Help File Content
|
1995-07-02
|
6KB
|
178 lines
# Copyright (c) 1991 Bell Communications Research, Inc. (Bellcore)
# Permission to use, copy, modify, and distribute this material
# for any purpose and without fee is hereby granted, provided
# that the above copyright notice and this permission notice
# appear in all copies, and that the name of Bellcore not be
# used in advertising or publicity pertaining to this
# material without the specific, prior written permission
# of an authorized representative of Bellcore. BELLCORE
# MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY
# OF THIS MATERIAL FOR ANY PURPOSE. IT IS PROVIDED "AS IS",
# WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
# Conversion from C shell to Bourne shell by Z-Code Software Corp.
# Conversion Copyright (c) 1992 Z-Code Software Corp.
# Permission to use, copy, modify, and distribute this material
# for any purpose and without fee is hereby granted, provided
# that the above copyright notice and this permission notice
# appear in all copies, and that the name of Z-Code Software not
# be used in advertising or publicity pertaining to this
# material without the specific, prior written permission
# of an authorized representative of Z-Code. Z-CODE SOFTWARE
# MAKES NO REPRESENTATIONS ABOUT THE ACCURACY OR SUITABILITY
# OF THIS MATERIAL FOR ANY PURPOSE. IT IS PROVIDED "AS IS",
# WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES.
if test -f /usr/lib/sendmail
MAILCOMMAND=/usr/lib/sendmail
MAILCOMMAND=/bin/mail
if test -z "$3"
echo "Usage: showexternal body-file access-type name [site [directory [mode]]]"
exit 1
if [ -z "$METAMAIL_TMPDIR" ]
METAMAIL_TMPDIR=/tmp
bodyfile=$1
atype=`echo $2 | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`
name=$3
site=$4
dir=$5
mode=$6
ctype=`grep -i content-type: $bodyfile | sed -e 's/............: //'`
cenc=`grep -i content-transfer-encoding: $bodyfile | sed -e 's/.........................: //'`
username=""
pass=""
TMPDIR=$METAMAIL_TMPDIR/XXXternal.$$
trap 'rmdir "$TMPDIR" >/dev/null 2>&1' 1 2 3 15
mkdir $TMPDIR
cd $TMPDIR
NEWNAME="mm.ext.$$"
NEEDSCONFIRMATION=1
case $atype in
anon-ftp)
echo "This mail message contains a POINTER (reference) to data that is "
echo not included in the message itself. Rather, the data can be retrieved
echo automatically using anonymous FTP to a site on the network. ;;
ftp)
echo "This mail message contains a POINTER (reference) to data that is "
echo not included in the message itself. Rather, the data can be retrieved
echo automatically using the FTP protocol to a site on the network. ;;
mail-server)
cat > $METAMAIL_TMPDIR/ext.junk.$$ <<!
This mail message contains a POINTER (reference) to data that is not
included in the message itself. Rather, the data can be retrieved by
sending a special mail message to a mail server on the network.
However, doing this automatically is slightly dangerous, because
someone might be using this mechanism to cause YOU to send obnoxious
mail. For that reason, the mail message that WOULD be sent is being
shown to you first for your approval.
This is the message that will be sent if you choose to go ahead and
retrieve the external data:
To: ${name}@${site}:
Subject: Automated Mail Server Request
cat $bodyfile >> $METAMAIL_TMPDIR/ext.junk.$$
more $METAMAIL_TMPDIR/ext.junk.$$
rm $METAMAIL_TMPDIR/ext.junk.$$ ;;
NEEDSCONFIRMATION=0 ;;
if test $NEEDSCONFIRMATION -ne 0
echo ""
echo_n "Do you want to proceed with retrieving the external data? [y] "
read ANS
case "$ANS" in
[Nn]*) rm -rf $TMPDIR; exit 0 ;;
esac
case "$atype" in
anon-ftp | ftp)
case "$atype" in
anon-ftp )
username=anonymous
pass=`whoami`@`hostname`
;;
esac
if test -z "$site"
then
echo_n "Site for ftp access: "
read site
if test -z "$username"
then
echo_n "User name at site ${site}: "
read username
if test -z "$pass"
then
echo_n "Password for user $username at site ${site}: "
stty -echo
read pass
stty echo
echo ""
if test -z "$dir"
then
DIRCMD=""
else
DIRCMD="cd $dir"
if test -z "$mode"
then
MODECMD=""
else
MODECMD="type $mode"
echo OBTAINING MESSAGE BODY USING FTP
echo SITE: $site USER: $username
${FTP:-ftp} -n <<!
open $site
user $username $pass
$DIRCMD
$MODECMD
get $name $NEWNAME
if test ! -r "$NEWNAME"
then
echo FTP failed.
rm -rf $TMPDIR
exit 1
afs|local-file)
if test ! -r $name
then
echo File not found
rm -rf $TMPDIR
exit 1
NEWNAME=$name
echo GETTING BODY FROM FILE NAMED: $NEWNAME ;;
mail-server)
if test -z "$bodyfile"
then
echo mail-server access-type requires a body file
rm -rf $TMPDIR
exit 1
echo Subject: Automated Mail Server Request > $NEWNAME
echo To: ${name}@${site} >> $NEWNAME
echo "" >> $NEWNAME
cat $bodyfile >> $NEWNAME
$MAILCOMMAND -t < $NEWNAME
if test $? -ne 0
then
echo sendmail failed
rm -rf $TMPDIR
exit 1
rm -rf $TMPDIR
echo Your $ctype data has been requested from a mail server.
exit 0 ;;
echo UNRECOGNIZED ACCESS-TYPE
rm -rf $TMPDIR
exit 1 ;;
if test "$cenc" = base64
mmencode -u -b < $NEWNAME > OUT
mv OUT $NEWNAME
elif test "$cenc" = quoted-printable
mmencode -u -q < $NEWNAME > OUT
mv OUT $NEWNAME
case "$atype" in
local-file ) metamail -b -c $ctype $NEWNAME ;;
* ) metamail -b -c "$ctype" $TMPDIR/$NEWNAME ;;
if test $? -ne 0
echo metamail failed
rm -rf $TMPDIR
exit 1
if test ! "$NEWNAME" = "$name"
echo ""
echo The data just displayed is stored in the file $TMPDIR/$NEWNAME
echo "Do you want to delete it?"
rm -i $NEWNAME
if test ! -r ${TMPDIR}/${NEWNAME}
cd /
rmdir $TMPDIR